package com.arges.controller;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexMatches {
 
 public static void main(String args[]) {
  String str = "00000000001311006082";
  String pattern = "^(([1-9][0-9]{6}|[0-9_@]{20,41})(\\$[0-9]){2}\\$[0-9]+)$";

  String str1 = "00000000001311006082$1$0$0";
  String pattern1 = "^(([1-9][0-9]{6}|[0-9]{20})(\\$[0-9]){2}\\$[0-9]+)|([0-9_@]{20,41})$";

  System.out.println(Pattern.compile(pattern).matcher(str).matches());
  System.out.println(Pattern.compile(pattern1).matcher(str1).matches());
 }

}